package xing.application.api.wechat;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import xing.application.api.client.WeChatClient;

import java.text.MessageFormat;

/*******************************************************************************************
 * 类描述：  
 *
 * @author: dustin
 * @date： 2017-10-18 15:33
 * @Description: 微信用户认证api
 * @version 1.0.0
 *
 *
 * Version    Date       ModifiedBy                 Content  
 * -------- ---------    ----------         ------------------------  
 * 1.0.0     2017-10-18    Administrator                            
 *******************************************************************************************
 */
@Service
public class UserAuth {

    @Autowired
    WeChatClient weChatClient;

    public String getSessionKey(String code){
        String res=
        weChatClient.getCommand("jscode2session",
                MessageFormat.format("appid={0}&secret={1}&js_code={2}&grant_type=authorization_code",
                            "wxaf865517f7739e74","3b1cc85ad79381debab0f206dd587fa1",code));
        return res;
    }

}
